# Importing Data
INDONESIA<- read_excel("C:/users/Biniam/Desktop/Documents/Academic/Thesis/Analysis Folder/Excel Files/Steel/TSA.xlsx",sheet = "Sheet1", range = "O1:O239")

# Checking the Imported Data
View(INDONESIA)
# Creating Time Series Data
INDONESIA_ts <- ts(INDONESIA, start=c(2000,1), end=c(2018 ,12), frequency=12)
# Viewing and Checking the Created Time Series Data
INDONESIA_ts
sum(is.na(INDONESIA_ts))
library(forecast)
INDONESIA_ts <- tsclean(INDONESIA_ts)
INDONESIA_ts

# Identification: Plotting the Time Series Data
plot(INDONESIA_ts)

# Estimating the appropriate model
INDONESIA_ts_model <- auto.arima(INDONESIA_ts)
INDONESIA_ts_model

# Forecasting
options(max.print=1000000)
INDONESIA_ts_forecast <- forecast (INDONESIA_ts_model, level=c(95), h=264)
plot(INDONESIA_ts_forecast)
INDONESIA_ts_forecast             

# Exporting
write.table(INDONESIA_ts_forecast, file="/users/Biniam/Desktop/Documents/Academic/Thesis/Result Folder/TSA Results/Excel Files/From R/Steel/INDONESIA_TSA.csv", sep=",")
